﻿/*
 * Jonathan
 * Created by: Jonathan Montiverdi
 * Date: 6/13/2012
 * License: http://jonathan.codeplex.com/license
 */
using System.IO;
using Jonathan.DataAccess.Sqlite;

namespace Jonathan.Data
{
   /// <summary>
   /// Represents a book for Jonathan.
   /// </summary>
   [SqliteTable ("Books", SqliteTableType.Record)]
   public class Book
   {
      /// <summary>
      /// Gets or Sets the name of the book.
      /// </summary>
      public string Name { get; set; }

      /// <summary>
      /// Gets or Sets the file name of the book.
      /// </summary>
      [SqliteName ("Database")]
      public string FileName { get; set; }
      
      /// <summary>
      /// Gets or Sets the book's author.
      /// </summary>
      public string Author { get; set; }
      
      /// <summary>
      /// Gets or Sets information about the book.
      /// </summary>
      public string About { get; set; }
      
      /// <summary>
      /// Gets or Sets if the book should be updated automatically.
      /// </summary>
      public bool UpdateAutomatically { get; set; }
      
      /// <summary>
      /// Gets if the database file's full path.
      /// </summary>
      [SqliteIgnore]
      public string FullPath { get { return Common.DATA_DIR + this.FileName; } }
      
      /// <summary>
      /// Gets if the database file exists or not.
      /// </summary>
      [SqliteIgnore]
      public bool FileExists { get { return File.Exists (this.FullPath);} }
   }
}
